-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mobile - Highlight words #36028
Mobile - Highlight words #36028
Conversation
Size Change: +34 B (0%) Total Size: 1.11 MB
ℹ️ View Unchanged
|
aa32acd
to
7a1b2cb
Compare
Hey @iamthomasbishop 👋 this feature is ready to be reviewed, would you mind checking it out when you have some time? Thank you so much! |
@geriux Thanks for the ping, this is looking and working great! I only have a few concerns, none of which are huge deals. I also noticed one semi-related thing, which isn't specific to this work but wanted to document in case we can tackle it soon. And then the last thing is a suggestion for future iterations, to have "on the record" 🙂 Let me know if you have any questions or if any of the requests will be especially challenging. Contrast with button backgroundOn the selected text color button, the icon can get lost in cases where the selected color is close to the background color of the button. Are we able to dynamically set the button background (behind the "A" icon) to the color of the actual block background behind it in the same way the web editor handles this? If not, we might want to consider a different treatment when a custom color is active. (Note: I understand that this exact same problem will arise if the user manually sets the text color to something close to the background color, but at least in that case the colors are accurate to the output and represented on the canvas itself; as well as in the preview.) Toolbar positionI'm curious, would it be difficult for us to move the colors button to a separate group on the block toolbar? As far as I know, we're simply following the order from the web, but I'm not sure if that is hard-coded or if we have flexibility in how we're organizing buttons/groups. If we have flexibility, I'd like to separate color out into its own group and place it either immediately after (preferred) or before the formatting group (bold, italic, etc), as demonstrated in these examples: Semi-relatedI'm not able to reproduce this on every tap so I'm unsure what the dimensions are on the "reset" tap target, but I noticed that tapping on or around the hex color label on the footer row of the top level sheet resets the value to its default. I'm assuming this is because most of our standard cell components act in a similar way, where the primary action's tap target spans the entire width of the cell. Ideally, the tap target for the "reset" button should only be as wide as the label (and perhaps slight bit of padding if there is any). For future considerationI noticed that if I have a custom color applied to a narrow selection — for example, a word or two in a sentence — then widen that selection to include the original (or go to the block-level color settings), then choose a new color for the wider selection, the previously-customized colors are essentially overridden. This might be expected behavior (I'm 100% sure it matches the behavior of web) but I can imagine a case where I'd like to "lock" certain color on part. |
Hey there @antonis @iamthomasbishop 👋 this is ready for another review =) Could you please check it when you have some time? These builds include the fixes to be able to set a text color when there's no text selected. Let me know if you find any issues while testing. Thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your hard work on this @geriux 🙇
These builds include the fixes to be able to set a text color when there's no text selected.
I tested the provided builds and and the issue is resolved. On a 1st pass the code changes also look good 👍
I noticed another issue when a text is not selected and you change the color with the caret at the end of the word (without a whitespace before).
On iOS the last character before the caret changes color
ios.mov
On Android the last character before the caret changes color and returns to the original color when you add a whitespace
android.mp4
Adding this extra observation in case it provides a hint in the source of the issue: On Android when you perform the same steps on a 2nd word the last letter f the 1st word changes color again and remains that way
android2.mp4
Hey @antonis 👋 Thank you for the feedback! I created new builds with a fix for the cases where the previous last character would change its color, can you please check it again and let me know? There's one edge case though when you want to change the color right after a character that already has a color set. If you don't add a space to change into a new color, it doesn't work. This also happens in core, since this feature is more focused to "Highlight" a selected text. |
@geriux I'm taking the latest build for a spin, it's looking great! I just have a couple of questions/bits of feedback, but I wouldn't necessarily consider them strictly blockers. Non-block based theme initial stateFor non-block-based themes — where we aren't able to display the site background-color and a block doesn't have an overridden background-color setting — can we set the default button background color on the ToolbarButton to the base surface color (white in light mode, black in dark mode) instead of the dark gray that the ToolbarButton currently is? I think this is the missing piece beyond the 3 edge cases you solved for in your previous round. Is something like this proposal possible? With background, no text colorsAnother thing, but this may be out of scope and may have already been discussed. When trying out different flows, I wondered if we should display the background color + default text color on the Toolbar in the case where I've first applied a custom BG color to a block but not adjusted any text colors. Example: Various statesHere's a quick matrix of the various states, current vs. proposed: For future considerationI've also got some ideas for how we might refine the styling on the toolbar button itself to be a bit more flexible, but we can leave that for a future iteration. For the sake of future consideration, here is a quick sketch of what I'm imagining: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for making these change @geriux 🙇
I created new builds with a fix for the cases where the previous last character would change its color, can you please check it again and let me know?
I retested the new builds and everything works as expected in my test. The code also LGTM 🎉
There's one edge case though when you want to change the color right after a character that already has a color set. If you don't add a space to change into a new color, it doesn't work. This also happens in core, since this feature is more focused to "Highlight" a selected text.
I was able to reproduce that and I agree that this is not blocking at this point. It would be nice if we could align the color written with the color of the button at the toolbar in this case but this can be handled as a separated issue.
video
color.mov
Hey @iamthomasbishop 👋 Thank you for the feedback! After our internal discussions in regards to the UI, I pushed the latest changes and you can check them once the builds are ready 🙇 |
# Conflicts: # packages/react-native-editor/CHANGELOG.md
@geriux Just tested the new build on iOS (iPhone 13 Pro and iPad Pro) and the changes we discussed yesterday are looking great. I'm not seeing any other issues on iOS but haven't had a chance to test on Android yet. I wouldn't expect any Android-specific issues, so if we can confirm that is the case then I think we can go ahead and ship this! |
Awesome!! 🚀 I checked the Android build and it was working as it was on iOS. Thank you so much for all the feedback and testing! 👏 |
Description
This PR adds the functionality to be able to customize colors for selected words. For now, users will only be able to change the text color, the functionality to customize the background color will not be supported on mobile for now.
How has this been tested?
Test case 1 - Using a color from a theme's color palette
Precondition: Site with a universal theme e.g Geologist, Quadrat, Zoologist.
Highlight
option and select itTest case 2 - Using a custom color
Precondition: Site with a universal theme e.g Geologist, Quadrat, Zoologist.
Highlight
option and select itCUSTOM
optionTest case 3 - Using a color from the default color palette
Precondition: Site without any custom theme colors e.g Blank Canvas
Highlight
option and select itScreenshots
Types of changes
New feature
Checklist:
*.native.js
files for terms that need renaming or removal).